-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Prisma TypedSQL #377
base: dev
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
"codegen-prisma": "pnpm run prisma generate", | ||
"codegen-prisma:watch": "pnpm run prisma generate --watch", | ||
"codegen": "pnpm run with-env bash -c 'if [ \"$STACK_ACCELERATE_ENABLED\" = \"true\" ]; then pnpm run prisma generate --no-engine && pnpm run generate-docs; else pnpm run codegen-prisma && pnpm run generate-docs; fi'", | ||
"codegen-prisma": "concurrently -k -s first \"tsx scripts/mock-postgres.mjs\" \"node -e \\\"setTimeout(() => process.exit(0), 2000)\\\" && cross-env STACK_DATABASE_CONNECTION_STRING=\\\"postgres://postgres@localhost:8118/postgres?pgbouncer=true&connection_limit=1\\\" STACK_DIRECT_DATABASE_CONNECTION_STRING=\\\"postgres://postgres@localhost:8118/postgres?connection_limit=1\\\" STACK_SEED_INTERNAL_PROJECT_PUBLISHABLE_CLIENT_KEY=\\\"test_key\\\" STACK_SEED_INTERNAL_PROJECT_SECRET_SERVER_KEY=\\\"test_secret\\\" STACK_SEED_INTERNAL_PROJECT_SUPER_SECRET_ADMIN_KEY=\\\"test_admin\\\" sh -c \\\"pnpm run prisma migrate reset --force && pnpm run prisma generate --sql\\\"\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we put this into a JS file instead (you can merge it with mock-postgres.mjs)
"codegen": "pnpm run with-env bash -c 'if [ \"$STACK_ACCELERATE_ENABLED\" = \"true\" ]; then pnpm run prisma generate --no-engine && pnpm run generate-docs; else pnpm run codegen-prisma && pnpm run generate-docs; fi'", | ||
"codegen-prisma": "concurrently -k -s first \"tsx scripts/mock-postgres.mjs\" \"node -e \\\"setTimeout(() => process.exit(0), 2000)\\\" && cross-env STACK_DATABASE_CONNECTION_STRING=\\\"postgres://postgres@localhost:8118/postgres?pgbouncer=true&connection_limit=1\\\" STACK_DIRECT_DATABASE_CONNECTION_STRING=\\\"postgres://postgres@localhost:8118/postgres?connection_limit=1\\\" STACK_SEED_INTERNAL_PROJECT_PUBLISHABLE_CLIENT_KEY=\\\"test_key\\\" STACK_SEED_INTERNAL_PROJECT_SECRET_SERVER_KEY=\\\"test_secret\\\" STACK_SEED_INTERNAL_PROJECT_SUPER_SECRET_ADMIN_KEY=\\\"test_admin\\\" sh -c \\\"pnpm run prisma migrate reset --force && pnpm run prisma generate --sql\\\"\"", | ||
"codegen-prisma:watch": "pnpm run codegen-prisma && chokidar \"prisma/**/*\" -c \"pnpm run codegen-prisma\"", | ||
"codegen": "pnpm run with-env bash -c 'if [ \"$STACK_ACCELERATE_ENABLED\" = \"true\" ]; then pnpm run prisma generate --sql --no-engine && pnpm run generate-docs; else pnpm run codegen-prisma && pnpm run generate-docs; fi'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? Why prisma generate --sql
when that environment variable is set, but pnpm run codegen-prisma
otherwise?
apps/backend/src/instrumentation.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was testing something, will put it back
}) | ||
}) | ||
|
||
server.listen(8118, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you document this in the dev launchpad?
.dockerignore
Outdated
@@ -57,6 +57,7 @@ packages/adapter-prisma/prisma/migrations | |||
db.sqlite | |||
packages/adapter-supabase/supabase/.branches | |||
packages/adapter-drizzle/.drizzle | |||
pglite-data/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pglite-data/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pglite generates a folder automatically, a lot of files will be committed if we don't ignore it
.gitignore
Outdated
@@ -58,6 +58,7 @@ packages/adapter-prisma/prisma/migrations | |||
db.sqlite | |||
packages/adapter-supabase/supabase/.branches | |||
packages/adapter-drizzle/.drizzle | |||
pglite-data/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pglite-data/ |
.dockerignore
Outdated
@@ -136,4 +137,4 @@ node_modules | |||
|
|||
deploy | |||
!deploy/docker/**/entrypoint.sh | |||
docker-compose.yaml | |||
docker-compose.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker-compose.yaml | |
docker-compose.yaml | |
Important
Introduces Prisma TypedSQL, updates dependencies, and modifies SQL queries to use typed SQL in the backend.
codegen-prisma:watch
script inpackage.json
to use--sql
flag.getUsersLastActiveAtMillis
incrud.tsx
to useprismaClient.$queryRawTyped
withgetUsersLastActiveAtMillisSql
.@prisma/client
andprisma
to version^6.1.0
inpackage.json
.@electric-sql/pglite
,chokidar-cli
, andpg-gateway
topackage.json
.typedSql
topreviewFeatures
inschema.prisma
.getUsersLastActiveAtMillis.sql
to handle user activity queries.mock-postgres.mjs
to handle database connections usingPGlite
.sentry.client.config.ts
.This description was created by for 259a780. It will automatically update as commits are pushed.